/**
 * Created by zhangwenlei on 2017/5/23.
 */
BCP.bill.model.ListbasedataModel = function(){
    BCP.bill.model.ListbasedataModel.superclass.constructor.call(this);
};

BCP.bill.model.ListbasedataModel.PROPERTY_INIT_DATA="initData";
BCP.bill.model.ListbasedataModel.PROPERTY_PROVIDER = "businessType";
BCP.bill.model.ListbasedataModel.PROPERTY_BINDING="binding";

COM.util.defineClass(BCP.bill.model.ListbasedataModel, ADF.model.BaseModel,{

    initModel: function() {
        BCP.bill.model.ListbasedataModel.superclass.initModel.call(this);
        var initData = new AGEF.PropertyDescriptor(BCP.bill.model.ListbasedataModel.PROPERTY_INIT_DATA, {}, "", true);
        initData.setTitle("基础数据设计");
        initData.setHint(initData.getTitle());
        initData.setEditorType("complexPropertyGroup.listbasedataEditor");
        this.addPropertyDescriptor(initData);
        var providerPD = new ADF.propertyDescriptor.DefaultPropertyDescriptor(BCP.bill.model.ListbasedataModel.PROPERTY_PROVIDER,"","",true, "提供器");
        providerPD.setAdditional("bcp.selector.ListSelector");
        providerPD.setEditorType("baseProperty.metadataEditor");
        this.addPropertyDescriptor(providerPD);
        this.addPropertyDescriptor(new BCP.bill.propertyDescriptor.BindingPropertyDescriptor(BCP.bill.model.ListbasedataModel.PROPERTY_BINDING,"","",true, "绑定"));
    },
    setBinding:function (binding) {
        this.setPropertyValue(BCP.bill.model.ListbasedataModel.PROPERTY_BINDING,binding);
    },
    getBinding:function () {
        return this.getPropertyValue(BCP.bill.model.ListbasedataModel.PROPERTY_BINDING);
    },
    setInitData: function(data) {
        this.setPropertyValue(BCP.bill.model.ListbasedataModel.PROPERTY_INIT_DATA, data);
    },
    getInitData: function() {
        return this.getPropertyValue(BCP.bill.model.ListbasedataModel.PROPERTY_INIT_DATA);
    },

    _getModelType : function(){
        return "BCP.bill.model.ListbasedataModel";
    },
    _getName : function(){
        return 'listBasedata';  
    },

    fillSerializedJson : function(jsonObject){
        jsonObject[BCP.bill.model.ListbasedataModel.PROPERTY_INIT_DATA]=this.getPropertyDescriptor(BCP.bill.model.ListbasedataModel.PROPERTY_INIT_DATA).serialize();
        jsonObject[BCP.bill.model.ListbasedataModel.PROPERTY_PROVIDER]=this.getPropertyDescriptor(BCP.bill.model.ListbasedataModel.PROPERTY_PROVIDER).serialize();
        jsonObject[BCP.bill.model.ListbasedataModel.PROPERTY_BINDING]=this.getPropertyDescriptor(BCP.bill.model.ListbasedataModel.PROPERTY_BINDING).serialize();
    },

    _deserialize:function (jsonObject) {
        var newProp=null;

        newProp=new AGEF.PropertyDescriptor();
        newProp.deserialize(jsonObject[BCP.bill.model.ListbasedataModel.PROPERTY_INIT_DATA]);
        this.propertyDescriptors.put(newProp.getName(),newProp);

        newProp=new AGEF.PropertyDescriptor();
        newProp.deserialize(jsonObject[BCP.bill.model.ListbasedataModel.PROPERTY_BINDING]);
        this.propertyDescriptors.put(newProp.getName(),newProp);

        if(jsonObject[BCP.bill.model.ListbasedataModel.PROPERTY_PROVIDER]){
            newProp=new ADF.propertyDescriptor.DefaultPropertyDescriptor();
            newProp.deserialize(jsonObject[BCP.bill.model.ListbasedataModel.PROPERTY_PROVIDER]);
            this.propertyDescriptors.put(newProp.getName(),newProp);
            
        }
    }

});